package com.vstartek.dm.util;

import java.text.ParseException;
import java.util.Date;

public class TimeUtil {
	
	public static String getNowTime(){
		java.text.DateFormat format1 = new java.text.SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		String s = format1.format(new Date());
		return s;
		
	}
	
	public static String format(Date date,String formet){
		java.text.DateFormat format1 = new java.text.SimpleDateFormat(formet);
		String s = format1.format(date);
		return s;
	}
	
	public static Date format(String time,String formet){
		java.text.DateFormat format1 = new java.text.SimpleDateFormat(formet);
		try {
			return format1.parse(time);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
	
	public static String getNowSTime(){
		java.text.DateFormat format1 = new java.text.SimpleDateFormat("yyyyMMddhhmmss");
		String s = format1.format(new Date());
		return s;
		
	}

}
